

f = open('/Users/hugo/Downloads/bunny/reconstruction/bun_zipper.ply', 'r').readlines()
poly = open('/Users/hugo/Downloads/bunny/reconstruction/bunny.poly', "w")

nov = int(f[3].split()[2])
nof = int(f[9].split()[2])

print len(f)
print nov, nof

poly.write("%d 3 0 0\n" % (nov))

for i in range(nov):
  l = f[i+12].split()
  poly.write("%d %s %s %s\n" % (i, l[0], l[1], l[2]))

poly.write("%d 0\n" % (nof))
for i in range(nof):
  poly.write("1 0\n")
  poly.write("%s" % (f[i+35959]))
poly.write("0\n0")
poly.close()
